Theoretically a 0 VIRT_BASE is okay. Change the bail code when
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 17 May 2006 22:41:59 +0000 (23:41 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Wed, 17 May 2006 22:41:59 +0000 (23:41 +0100)
parsing elf headers to bail only when VIRT_BASE is not specified
at all.
Signed-off-by: Keir Fraser <keir@xensource.com>
tools/libxc/xc_load_elf.c

index c09f819467626423793b6badf052957ffecfd023..33b07bdb3f7ed919974b078394e6bfaeb5dd407e 100644 (file)
@@ -148,16 +148,14 @@ static int parseelfimage(const char *image,
 
     dsi->xen_guest_string = guestinfo;
 
-    virt_base = 0;
-    if ( (p = strstr(guestinfo, "VIRT_BASE=")) != NULL )
-        virt_base = strtoul(p+10, &p, 0);
-
-    if ( virt_base == 0 )
+    if ( (p = strstr(guestinfo, "VIRT_BASE=")) == NULL )
     {
-        ERROR("Malformed ELF image. VIRT_BASE in '__xen_guest' section set incorrectly");
+        ERROR("Malformed ELF image. No VIRT_BASE specified");
         return -EINVAL;
     }
 
+    virt_base = strtoul(p+10, &p, 0);
+
     dsi->elf_paddr_offset = virt_base;
     if ( (p = strstr(guestinfo, "ELF_PADDR_OFFSET=")) != NULL )
         dsi->elf_paddr_offset = strtoul(p+17, &p, 0);